   // 生产假硬币的辅助函数
   var insertStaticCoin = function(coin) {
	   var fakeImg = document.createElement("img")
	   var parentDiv = document.querySelector(wanfaObject[coin.wanfa])
	   fakeImg.src =  "/img/caizhong/bjl/coin-" + coin.dianshu + "-2x.png"
	   fakeImg.classList.add("class-img-fakeCoins")
	   fakeImg.classList.add("class-img-mygameCoin")
	   var leftValueNum = Number(parentDiv.dataset.leftnum)
	   var topHeight = document.querySelector(".class-div-content").clientHeight
	   var randomRight = document.querySelector(".class-div-content").clientWidth + (parentDiv.clientWidth * leftValueNum)
	   fakeImg.style.top = topHeight + "px"
	   fakeImg.style.left = randomRight + "px"
	   parentDiv.insertAdjacentElement("beforeend", fakeImg)
	   setTimeout(function() {
		   fakeImg.style.top = coin.topValue + "px"
		   fakeImg.style.left = coin.leftValue + "px"
	   }, 100)
   }
   
   //补闲家的牌
   var addXianJiaCard = function(xiaJiaCard) {
	   var html = 
		"<div id='id-div-cardItemDiv" + 5 +"' class='viewport-flip cardItemRight slow'><a class='list flip out beimian'><img class='class-img-pockCard' src='"+"/img/caizhong/bjl/" + xiaJiaCard + ".png' /></a>"+
		"<a class='list flip zhengmian'><img class='class-img-pockCard' src='"+"/img/caizhong/bjl/pockCard-2x.png' /></a>"	
		var contentDiv = document.querySelector(".class-div-content")
		contentDiv.insertAdjacentHTML("beforeend", html)
			var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv5")
			$(cardItemRightDiv).offset()
		if (isHorizontalScreen()) {
			cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
			cardItemRightDiv.style.top = getHorizontalTop() + "px"
			cardItemRightDiv.style.right = getRight5() + "px"	
		} else {
			cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
			var rightNum = document.querySelector(".class-div-part").offsetTop
			cardItemRightDiv.style.top = getVerticalTop() + "px"
			cardItemRightDiv.style.right = getRight5() + "px"
		}
		setTimeout(function() {
			 var eleBack5 = null
			 var eleFront5 = null
			 var eleList5 = $("#id-div-cardItemDiv5 .list")
	 		 eleList5.each(function() {
		        if ($(this).hasClass("out")) {
		        	eleBack5 = $(this);
		        } else {
		        	eleFront5 = $(this);
		        }
		     });
			 eleFront5.addClass("out").removeClass("in");
		     setTimeout(function() {
		        eleBack5.addClass("in").removeClass("out");
		     }, 225);					
		}, 1000)
	}
   
   //补庄家的牌
   var addZhuangJiaCard = function(zhuangjiaCard) {
	   var html = 
		"<div id='id-div-cardItemDiv" + 6 +"' class='viewport-flip cardItemRight slow'><a class='list flip out beimian'><img class='class-img-pockCard' src='"+"/img/caizhong/bjl/" + zhuangjiaCard + ".png' /></a>" +
		"<a class='list flip zhengmian'><img class='class-img-pockCard' src='"+"/img/caizhong/bjl/pockCard-2x.png' /></a>"	
		var contentDiv = document.querySelector(".class-div-content")
		contentDiv.insertAdjacentHTML("beforeend", html)
		var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv6")
		$(cardItemRightDiv).offset()
		cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
		cardItemRightDiv.style.right = getRight6() + "px"	
		if (isHorizontalScreen()) {
			cardItemRightDiv.style.top = getHorizontalTop() + "px"
		} else {
			var rightNum = document.querySelector(".class-div-part").offsetTop
			cardItemRightDiv.style.top = getVerticalTop() + "px"
		}
		setTimeout(function() {
			 var eleBack6 = null
			 var eleFront6 = null
			 var eleList6 = $("#id-div-cardItemDiv6 .list")
	 		 eleList6.each(function() {
		        if ($(this).hasClass("out")) {
		        	eleBack6 = $(this);
		        } else {
		        	eleFront6 = $(this);
		        }
		     });
			 eleFront6.addClass("out").removeClass("in");
		     setTimeout(function() {
		        eleBack6.addClass("in").removeClass("out");
		     }, 225);					
		}, 1000)			
	}	 	
   
	//直接展示 4 张牌，因为用户进来的时候牌已经发好了
	var notNoralToAddFourCard = function(data) {
	    console.log(data,"data候牌已经发展示")
		//var dataArray = data.split("@")
	    //庄家
		//var zhuangjiaArray = dataArray[0].split(",")
	    //闲家
		//var xianjiaArray = dataArray[1].split(",")
	    var item1 = document.createElement("img")
	    var item2 = document.createElement("img")
	    var item3 = document.createElement("img")
	    var item4 = document.createElement("img")
	    var itemsArray = [item1, item2, item3, item4]
	    item1.style.right = getRight1() + "px"
	    item2.style.right = getRight2() + "px"
	    item3.style.right = getRight3() + "px"
	    item4.style.right = getRight4() + "px"
	    var topValue
	    if (isHorizontalScreen()) {
			topValue = getHorizontalTop()
	    } else {
	    	topValue = getVerticalTop()
	    }
		for (var i = 0; i < itemsArray.length; i++) {
			var newItem = itemsArray[i]
			newItem.style.top = topValue + "px"
			newItem.style.transform = "rotate(0deg) scale(1)"
			newItem.classList.add("cardItemRight")
		}							  
	    item1.src = "/img/caizhong/bjl/" + data.leisure2 + ".png"
	    item2.src = "/img/caizhong/bjl/" + data.leisure1 + ".png"
	    item3.src = "/img/caizhong/bjl/" + data.zhuang1 + ".png"
	    item4.src = "/img/caizhong/bjl/" + data.zhuang2 + ".png"
	    var contentDiv = document.querySelector(".class-div-content")
	    contentDiv.insertAdjacentElement("beforeend", item1)
	    contentDiv.insertAdjacentElement("beforeend", item2)
	    contentDiv.insertAdjacentElement("beforeend", item3)
	    contentDiv.insertAdjacentElement("beforeend", item4)
	     if (data.leisureCard != null) {
	    	 xianJiaBu = data.leisureCard
	     }
	     if (data.dealerCard != null) {
	    	 zhuangJiaBu = data.dealerCard
	     }				
	}
	
	// 直接插入闲家的补牌，因为用户进来的时候，补牌已经补好了 
	var notNoralToAddFiveCard = function(xianJiaBuData) {
		 var item5 = document.createElement("img")
   	 item5.src = "/img/caizhong/bjl/" + xianJiaBuData + ".png"
   	 item5.style.right = getRight5() + "px"
   	 var topValue
   	 if (isHorizontalScreen()) {
   		 topValue = getHorizontalTop()
   	 } else {
   		 topValue = getVerticalTop()
   	 }
   	 item5.style.top = topValue + "px"
   	 item5.style.transform = "rotate(0deg) scale(1)"
   	 item5.classList.add("cardItemRight")
   	 var contentDiv = document.querySelector(".class-div-content")
   	 contentDiv.insertAdjacentElement("beforeend", item5)			
	}
	
	// 直接插入庄家的补牌，因为用户进来的时候，补牌已经补好了 
	var notNoralToAddSixCard = function(zhuangJiaBuData) {
   	 var item6 = document.createElement("img")
   	 item6.src = "/img/caizhong/bjl/" + zhuangJiaBuData + ".png"
   	 item6.style.right = getRight6() + "px"
   	 var topValue
   	 if (isHorizontalScreen()) {
   		 topValue = getHorizontalTop()
   	 } else {
   		 topValue = getVerticalTop()
   	 }
   	 item6.style.top = topValue + "px"
   	 item6.style.transform = "rotate(0deg) scale(1)"
   	 item6.classList.add("cardItemRight")
   	 var contentDiv = document.querySelector(".class-div-content")
   	 contentDiv.insertAdjacentElement("beforeend", item6)		
	}	
	
	// 赢的结果高亮
	var settingResultDivHighLight = function() {
		// var newDataArray = zhuangXianArray.data.split("@")
		 var newDataArray = zhuangXianArray
		 console.log(zhuangXianArray,"zhuangXianArray的值")
		 //拿到赢家
		// var resultWin = newDataArray[newDataArray.length - 2]
		 console.log(newDataArray.data.winner)
		 var resultWin
		 if(newDataArray.data.winner == 0){
			  resultWin = "闲赢"
		 }else if(newDataArray.data.winner == 1){
			  resultWin = "庄赢"
		 }else if(newDataArray.data.winner == 2){
			  resultWin = "和局"
		 }
		 console.log(resultWin,"resultWin的值")
		 // var zhuangjiaArray = newDataArray[0].split(",")
		
		 //抛开数据的地方 闲  fangpj,meiha,1,meih9,0,
		
		 // var xianjiaArray = newDataArray[1].split(",")
		 //bjl.getZhuang() + "@" + bjl.getXian() + "@" + bjl.getYingjia() + "@" + bjl.getDuizhi();
//		 zhuangDianShu = zhuangjiaArray[zhuangjiaArray.length - 2]
		 zhuangDianShu = newDataArray.data.makerSFinalPoints
		
		// xianDianShu = xianjiaArray[xianjiaArray.length - 2]
		 xianDianShu = newDataArray.data.leisureHomePoints
		 
		 yingResultText = yingMusicObject[resultWin]
  			XIAN_SOUND = new Howl({
 			  src: [MUSIC_PATH + "x" + xianDianShu + ".mp3"]
 			});
 			ZHUANG_SOUND = new Howl({
 			  src: [MUSIC_PATH + "z" + zhuangDianShu + ".mp3"]
 			});
 			RESULT_SOUND = new Howl({
 			  src: [MUSIC_PATH + yingResultText]
 			});
 			XIAN_SOUND.on("end", function(id) {
 				ZHUANG_SOUND.play()
 			})
 			ZHUANG_SOUND.on("end", function(id) {
 				RESULT_SOUND.play()
 			})
 			XIAN_SOUND.play()
 			document.querySelector("#id-span-zhuang-resultCount").innerHTML = zhuangDianShu
 			document.querySelector("#id-span-xian-resultCount").innerHTML = xianDianShu		
 			console.log(resultWin,"resultWin 哈哈哈哈  resultWin 的值")
 			var winDivPicker = yingObject[resultWin]
		    var winDiv = document.querySelector(winDivPicker)
		    winDiv.classList.add("class-getResultHightLightDiv")
			zhuangXianArray = []
			xianJiaBu = undefined
			zhuangJiaBu	= undefined	
			if($("#notice div").text()!="null"){
				$("#notice").fadeIn("slow")
			}
	}		
	
	// 清空上把的点数和高亮的结果 div
	var removeHighLightClassAndNumber = function() {
			document.querySelector("#id-span-zhuang-resultCount").innerHTML = ""
			document.querySelector("#id-span-xian-resultCount").innerHTML = ""
			var highLightDiv = document.querySelector(".class-getResultHightLightDiv")
			if (highLightDiv != null) {
				$(highLightDiv).removeClass("class-getResultHightLightDiv")
			}
	}
	
	// 移除所有这把的扑克牌
	   var removeAllCards = function() {
			var allCards = document.querySelectorAll(".cardItemRight")
			for (var i = 0; i < allCards.length; i++) {
				var item = allCards[i]
				$(item).removeClass("slow")
				item.style.right = (document.querySelector(".class-div-content").clientWidth / 2 - item.clientWidth / 2) + "px"
			}
			// class-img-smallCoin
			// class-img-fakeCoins
			var smallCoins = document.querySelectorAll(".class-img-mygameCoin")
			for (var q = 0; q < smallCoins.length; q++ ) {
				var item = smallCoins[q]
				item.style.top = document.documentElement.clientHeight / 2 + (item.clientHeight * 2) + "px"
			}	
			setTimeout(function() {
				for (var q = 0; q < smallCoins.length; q++ ) {
					var item = smallCoins[q]
					$(item).remove()
				}				
			}, 500) 			
			setTimeout(function() {
			for (var i = 0; i < allCards.length; i++) {
				var item = allCards[i]
				item.style.top = "-" + (item.clientHeight + 10) + "px"
			}					
			}, 500) 		
			setTimeout(function() {
				for (var i = 0; i < allCards.length; i++) {
					var item = allCards[i]
					$(item).remove()
				}					
			}, 1000) 
			$("#notice").fadeOut("slow")
		}
	   
	   
	   // 直接插入假硬币(因为用户来晚了)
	   var justSetCoin = function(coin) {
		   var fakeImg = document.createElement("img")
		   fakeImg.src = "/img/caizhong/bjl/coin-" + coin.dianshu + "-2x.png"
		   fakeImg.classList.add("class-img-fakeCoins")
		   fakeImg.classList.add("class-img-mygameCoin")
		   fakeImg.style.top = coin.topValue + "px"
		   fakeImg.style.left = coin.leftValue + "px"
		   document.querySelector(wanfaObject[coin.wanfa]).insertAdjacentElement("beforeend", fakeImg)	   
	   }
	   
	   
	   
	   // 发 4 张牌
		var createCardsFirst = function() {
			var contentDiv = document.querySelector(".class-div-content")
			var offsetRightNumber
			var offsetLargeRightNumber
			var offsetLeftNumber
			var offsetLargeLeftNumber
			var i = 0
			var idObj = {
				"0": "1",
				"1": "2",
				"2": "0",
				"3": "3",
			}
			var intervalEventId = setInterval(function() {
				if($('#bjllot').length==0){
					clearInterval(intervalEventId)
					return;
				}
				// 0 闲右
				// 1 闲左
				// 3 庄左
				// 4 庄右
				var html = 
					"<div id='id-div-cardItemDiv" + idObj[i] +"' class='viewport-flip cardItemRight slow'><a class='list flip out beimian'><img class='class-img-pockCard' src='' /></a>"+
					"<a class='list flip zhengmian'><img class='class-img-pockCard' src='"+"/img/caizhong/bjl/pockCard-2x.png' /></a>"				
				if (i == 4) {
					clearInterval(intervalEventId)
					getServerCards()
				}
				else if (i == 0) {
					contentDiv.insertAdjacentHTML("beforeend", html)
					var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv" + 1)
					if (isHorizontalScreen()) {
						$(cardItemRightDiv).offset()
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = getHorizontalTop() + "px"
					} else {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						var rightNum = document.querySelector(".class-div-part").offsetTop
						cardItemRightDiv.style.top = getVerticalTop() + "px"
					}
					cardItemRightDiv.style.right = getRight2() + "px"					
				}
				else if (i == 1) {
					contentDiv.insertAdjacentHTML("beforeend", html)
					var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv" + 2)
					$(cardItemRightDiv).offset()
					if (isHorizontalScreen()) {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = getHorizontalTop() + "px"
					} else {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						var rightNum = document.querySelector(".class-div-part").offsetTop
						cardItemRightDiv.style.top = getVerticalTop() + "px"
					}
					cardItemRightDiv.style.right = getRight3() + "px"					
				}
				else if (i == 2) {
					contentDiv.insertAdjacentHTML("beforeend", html)
					var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv" + 0)
					$(cardItemRightDiv).offset()
					if (isHorizontalScreen()) {
						var topValue = getHorizontalTop()
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = topValue + "px"
					} else {
						var rightNum = document.querySelector(".class-div-part").offsetTop
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						var topValue = getVerticalTop()
						cardItemRightDiv.style.top = topValue + "px"
					}
					var rightValue = getRight1()
					cardItemRightDiv.style.right = rightValue + "px"					
				}
				else if (i == 3) {
					contentDiv.insertAdjacentHTML("beforeend", html)
					var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv" + 3)
					$(cardItemRightDiv).offset()
					if (isHorizontalScreen()) {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = getHorizontalTop() + "px"
					} else {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = getVerticalTop() + "px"
					}
					cardItemRightDiv.style.right = getRight4() + "px"					
				}
				/*else if (i == 0) {  // 闲右
					contentDiv.insertAdjacentHTML("beforeend", html)
					var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv" + i)
					if (isHorizontalScreen()) {
						var topValue = getHorizontalTop()
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = topValue + "px"
					} else {
						var rightNum = document.querySelector(".class-div-part").offsetTop
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						var topValue = getVerticalTop()
						cardItemRightDiv.style.top = topValue + "px"
					}
					var rightValue = getRight1()
					cardItemRightDiv.style.right = rightValue + "px"
				}
				else if (i == 1) { // 闲左
					
					contentDiv.insertAdjacentHTML("beforeend", html)
					var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv" + i)
					if (isHorizontalScreen()) {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = getHorizontalTop() + "px"
					} else {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						var rightNum = document.querySelector(".class-div-part").offsetTop
						cardItemRightDiv.style.top = getVerticalTop() + "px"
					}
					cardItemRightDiv.style.right = getRight2() + "px"
				}
				else if (i == 2) { // 庄左
					
					contentDiv.insertAdjacentHTML("beforeend", html)
					var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv" + i)
					if (isHorizontalScreen()) {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = getHorizontalTop() + "px"
					} else {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						var rightNum = document.querySelector(".class-div-part").offsetTop
						cardItemRightDiv.style.top = getVerticalTop() + "px"
					}
					cardItemRightDiv.style.right = getRight3() + "px"
				}
				else if (i == 3) { // 庄右
					
					contentDiv.insertAdjacentHTML("beforeend", html)
					var cardItemRightDiv = document.querySelector("#id-div-cardItemDiv" + i)
					if (isHorizontalScreen()) {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = getHorizontalTop() + "px"
					} else {
						cardItemRightDiv.style.transform = "rotate(0deg) scale(1)"
						cardItemRightDiv.style.top = getVerticalTop() + "px"
					}
					cardItemRightDiv.style.right = getRight4() + "px"
				}					*/
				i = i + 1
			}, 750)
		}
	
		
		   // 翻牌   
		   //1  闲左  
		   //2  庄左
		   //0  闲右
		   //3  庄右
		   var dealServerCards = function(newData) {
			     var cardInfoData = newData.data
			    // var dataArray = cardInfoData.split("@")
			     //var zhuangjiaArray = dataArray[0].split(",")
			     //var xianjiaArray = dataArray[1].split(",")
			     //闲家
			    /* if (xianjiaArray.length > 4) {
			    	 xianJiaBu = xianjiaArray[3]
			     }*/
				 var oneCardItem = document.querySelector("#id-div-cardItemDiv1")
				 var zeroCardItem = document.querySelector("#id-div-cardItemDiv0")
				 oneCardItem.querySelector(".out").querySelector("img").src =  "/img/caizhong/bjl/" +cardInfoData.leisure1 + ".png"
				 zeroCardItem.querySelector(".out").querySelector("img").src =  "/img/caizhong/bjl/" + cardInfoData.leisure2 + ".png" 
			     //庄家
				/* if (zhuangjiaArray.length > 4) {
			    	 zhuangJiaBu = zhuangjiaArray[3]
			     }*/
				 //获取id-div-cardItemDiv2 用于展示开出来的牌
				 var ThreeCardItem = document.querySelector("#id-div-cardItemDiv2")
				 var FourCardItem = document.querySelector("#id-div-cardItemDiv3")
				 ThreeCardItem.querySelector(".out").querySelector("img").src =  "/img/caizhong/bjl/" + cardInfoData.zhuang1 + ".png"
				 FourCardItem.querySelector(".out").querySelector("img").src =  "/img/caizhong/bjl/" + cardInfoData.zhuang2 + ".png"
				 var eleBack1 = null
				 var eleFront1 = null
				 var eleList1 = $("#id-div-cardItemDiv1 .list")
		 		 eleList1.each(function() {
			        if ($(this).hasClass("out")) {
			            eleBack1 = $(this);
			        } else {
			            eleFront1 = $(this);
			        }
			     });
			     eleFront1.addClass("out").removeClass("in");
			     setTimeout(function() {
			        eleBack1.addClass("in").removeClass("out");
			     }, 225);	 
			     
			     setTimeout(function() {
					 var eleBack2 = null
					 var eleFront2 = null
					 var eleList2 = $("#id-div-cardItemDiv0 .list")
			 		 eleList2.each(function() {
				        if ($(this).hasClass("out")) {
				            eleBack2 = $(this);
				        } else {
				            eleFront2 = $(this);
				        }
				     });
				     eleFront2.addClass("out").removeClass("in");
				     setTimeout(function() {
				        eleBack2.addClass("in").removeClass("out");
				     }, 225);		    	 
			     }, 675)
			   
			     setTimeout(function() {
					 var eleBack3 = null
					 var eleFront3 = null
					 var eleList3 = $("#id-div-cardItemDiv2 .list")
					 eleList3.each(function() {
				        if ($(this).hasClass("out")) {
				            eleBack3 = $(this);
				        } else {
				            eleFront3 = $(this);
				        }
				     });
				     eleFront3.addClass("out").removeClass("in");
				     setTimeout(function() {
				        eleBack3.addClass("in").removeClass("out");
				     }, 225);		    	 
			     }, 1350)
			     
			     setTimeout(function() {
					 var eleBack4 = null
					 var eleFront4 = null
					 var eleList4 = $("#id-div-cardItemDiv3 .list")
			 		 eleList4.each(function() {
				        if ($(this).hasClass("out")) {
				        	eleBack4 = $(this);
				        } else {
				        	eleFront4 = $(this);
				        }
				     });
					 eleFront4.addClass("out").removeClass("in");
				     setTimeout(function() {
				        eleBack4.addClass("in").removeClass("out");
				     }, 225);		     
				     	    	 
			     }, 2025)
			     
			     setTimeout(function() {
				     if (cardInfoData.leisureCard != null) {
				    	 addXianJiaCard(cardInfoData.leisureCard )
				     } 
			     }, 2700)	     

			     setTimeout(function() {
				     if (cardInfoData.dealerCard != null) {
				    	 addZhuangJiaCard(cardInfoData.dealerCard )
				     } 
			     }, 4050)	     
			     
			   }
		
		
		// 绑定游戏硬币点击事件
		var bindGameCoinsClickEvent = function() {
			var gameCoins = document.querySelectorAll(".class-img-gameCoin")
			for (var i = 0; i < gameCoins.length; i++) {
				var item = gameCoins[i]
				
				item.addEventListener(getEndClickEvent(), function(event) {
					
					var currentTime = Number(document.querySelector("#id-span-clockTimeNumber").innerHTML)
					if (currentTime <= 0) {
						setNoticeDivHTML("已超出下注时间，无法下注")
						return
					}
					var self = event.target
					if (self.classList.contains("class-img-gameCoin-large")) {
						self.classList.remove("class-img-gameCoin-large")
					} else {
						var currentCoin = document.querySelector(".class-img-gameCoin-large")
						if (currentCoin != null) {
							currentCoin.classList.remove("class-img-gameCoin-large")
						}
						self.classList.add("class-img-gameCoin-large")
					}
				})
			}
		}	
		var count=0;  //点击次数
		//点击次数
		var iii = 0;
		//金额
		var betsMoney = 0;
		//游戏类型
		var gameType;
		// 地址
		var address;
		//闲
		var xian = 0.00
		//庄
		var zhuang= 0.00
		//闲对
		var xiandui= 0.00
		//庄对
		var zhuangdui= 0.00
		//和
		var he=	0.00
		var bindgameModeDivEvent = function() {
			var wanfaModeDiv = document.querySelectorAll(".class-div-wanfa")
			for (var i = 0; i < wanfaModeDiv.length; i++) {
				var item = wanfaModeDiv[i]
				item.addEventListener(getEndClickEvent(), function(event) {
					var parentDiv = getClosestParent(event.target, "class-div-wanfa")
					var currentChooseCoin = document.querySelector(".class-img-gameCoin-large")
					if (currentChooseCoin == null) {
						return
					}else{
						count++
						iii++
					var currentTime = Number(document.querySelector("#id-span-clockTimeNumber").innerHTML)
					if (currentTime <= 0) {
						setNoticeDivHTML("已超出下注时间，无法下注")
						return
					}					
					var moneyNum = currentChooseCoin.dataset.coinnum
					var currentGameName = parentDiv.dataset.gamename
					var ajaxObject = {
						money: moneyNum,
						issueNumber: currentMark,	
						xian:"",
						zhuang:"",
						xiandui:"",
						zhuangdui:"",
						he:	"",	
						tableNumber: ROOM_ID,
					}
					ajaxObject[currentGameName] = moneyNum
					var urlPath =  "/b/bjlBets.do"
					address = urlPath
					}
					var currentMoneySpan = document.querySelector("#id-span-userCurrentMoney")
					var dataNum = currentChooseCoin.dataset.coinnum
					var newCoin = document.createElement("div")
					newCoin.classList.add("class-img-smallCoin")
					newCoin.classList.add("class-img-mygameCoin")
					newCoin.classList.add("class-img-myBetCoins")
					newCoin.style.backgroundImage = "url("+ "/img/caizhong/bjl/coin-" + dataNum + "-2x.png)"
					var modeName = parentDiv.dataset.gamename
					if(betsMoney == 0){
						gameType = modeName;
					}
					if(modeName == 'xian'){
						xian += parseInt(moneyNum)
					}
					if(modeName == 'zhuang'){
						zhuang += parseInt(moneyNum)
					}
					if(modeName == 'xiandui'){
						xiandui += parseInt(moneyNum)
					}
					if(modeName == 'zhuangdui'){
						zhuangdui += parseInt(moneyNum)
					}
					if(modeName == 'he'){
						he += parseInt(moneyNum)
					}
					$("#id-span-xiazhumoney").text(xian+zhuang+xiandui+zhuangdui+he)
					var leftValue
					newCoin.style.top = document.querySelector(".class-div-content").clientWidth / 2 + "px"
					var itemValue = Number(document.documentElement.dataset.fontrem)
					if (modeName == "xiandui") {
						leftValue = parentDiv.clientWidth + document.querySelector(".class-div-he").clientWidth / 2
					}
					else if (modeName == "he") {
						leftValue = parentDiv.clientWidth / 2
					}
					else if (modeName == "zhuangdui") {
						leftValue = -(document.querySelector(".class-div-he").clientWidth * 0.75)
					}
					else if (modeName == "xian") {
						leftValue = parent.clientWidth * 0.8
					}
					else if (modeName == "zhuang") {
						leftValue = -(parent.clientWidth)										
					}
					newCoin.style.left = leftValue
					parentDiv.insertAdjacentElement("beforeend", newCoin)
					setTimeout(function() {
						var getRandomTop = randomFrom(0, parentDiv.clientHeight - newCoin.clientHeight)
						var getRandomLeft = randomFrom(newCoin.clientWidth, parentDiv.clientWidth / 2)
						newCoin.style.top = getRandomTop + "px"
						newCoin.style.left = getRandomLeft + "px"
					}, 50)
				})
			}
		}
		
		//投注确定
		var xiazhu = function(){
			var betDiv = document.querySelector("#button-Determine")
			betDiv.addEventListener(getNormalClickEvent(), function(event) {
			var currentTime = Number(document.querySelector("#id-span-clockTimeNumber").innerHTML)
			if (currentTime <= 0) {
				setNoticeDivHTML("已超出下注时间，无法下注")
				return
			}				
			var totalBet = xian+zhuang+xiandui+zhuangdui+he
			var xianj = ""
			var zhuangj = ""
			var zhuangd = ""
			var xiand = ""
			var hej = ""
			var daj=""
			var xiaoj=""
			var wanmeid=""
			var renyid=""
			var amountOfMoney = 0
			var cashDownAmount = 0
			var cashPairDownAmount = 0
			var zhuangdusBetOnTheAmount = 0
			var andTheAmountOfTheBet = 0
			/*var bigAmount = 0
			var smallAmount=0
			var perfectAmount=0
			var randomAmount=0*/
			if(xian > 0){
				cashDownAmount = xian
				xianj = "闲家"
			}
			if(zhuang > 0){
				amountOfMoney = zhuang
				zhuangj = "闲家"
			}
			if(xiandui > 0){
				cashPairDownAmount = xiandui
				xiand = "闲对"
			}
			if(zhuangdui > 0){
				zhuangd = "庄对"
				zhuangdusBetOnTheAmount = zhuangdui
			}
			if(he > 0){
				andTheAmountOfTheBet = he
				hej = "和"
			}/*if(big>0){
				bigAmount=big
			}if(small>0){
				smallAmount=small
			}if(wanmeiduizi>0){
				perfectAmount=wanmeiduizi
			}if(randomduizi>0){
				randomAmount=randomduizi
			}*/
			var issueNumber = currentMark
			var tableNumber = ROOM_ID
			if(totalBet <= 0){
				setNoticeDivHTML("下注余额不能为空噢!")
				return
			}
				var newRequest = {
				url: address,
				type: "post",
				data: {
					issueNumber: issueNumber,	
					xian:xianj,
					zhuang:zhuangj,
					xiandui:xiand,
					zhuangdui:zhuangd,
					he:	hej,
					//庄家下注金额
					amountOfMoney:amountOfMoney,
					//闲家下注金额
					cashDownAmount:cashDownAmount,
					//闲对下注金额
					cashPairDownAmount:cashPairDownAmount,
					//庄对下注金额
					zhuangdusBetOnTheAmount:zhuangdusBetOnTheAmount,
					//和局下注金额
					andTheAmountOfTheBet:andTheAmountOfTheBet,
					//下载总额
					totalBet: totalBet,
					tableNumber: tableNumber,
				},
				success: function(data) {
					var newData = JSON.parse(data)
					console.log(newData.data,'newData.data的值')
					if (newData.data === 0) {
						setNoticeDivHTML("下注失败")
						return
					}else if(newData.data == 2){
						setNoticeDivHTML("余额不足,下注失败")
						return
					}else if(newData.data == 3){
						setNoticeDivHTML("该期已结束")
						return
					}else if(newData.data ==1){
					xian = 0.00
					zhuang = 0.00
					xiandui = 0.00
					zhuangdui = 0.00
					he = 0.00
					iii = 0;
					var urlPath =  "/b/Money.do"
					var newRequest = {
						url: urlPath,
						type: "post",
						data: {
						},
						success: function(data) {
							var newData = JSON.parse(data)
							console.log(newData,'newData Money的值')
							var currentMoneySpan = document.querySelector("#id-span-userCurrentMoney")
							currentMoneySpan.innerHTML = newData.data
						},
					}
					ajax(newRequest)	
					layerContent(totalBet)
					$("#id-span-xiazhumoney").text(xian+zhuang+xiandui+zhuangdui+he)
					}
				},
				error: function(status) {
					setNoticeDivHTML("网络异常，下注失败")
				}
			}
			ajax(newRequest)
			})
		}
		
		// 计算假硬币的最大坐标
		var getTopAndLeft = function(element) {
			var result = {}
			var webRem = Math.floor(Number(document.documentElement.dataset.fontrem))
			var itemValue = Math.floor(webRem * 0.8)
			var maxTop = Math.floor(element.clientHeight - itemValue)
			var maxLeft = Math.floor(element.clientWidth - itemValue - Math.floor(webRem * 2))
			result.top = maxTop
			result.left = maxLeft
			return result
		}	
		
		
		// 时间倒计时时，射入jia硬币
		var getFakeCoinsFromServer = function(n) {
			var urlPath =  "/b/coin.do"
			if (n <= 3) {
				urlPath =  "/b/coin.do"
			}
			var xianduiObject = getTopAndLeft(document.querySelector(".class-div-xiandui"))
			var heObject = getTopAndLeft(document.querySelector(".class-div-he"))
			var zhuangduiObject = getTopAndLeft(document.querySelector(".class-div-zhuangdui"))
			var xianObject = getTopAndLeft(document.querySelector(".class-div-wanfa-textXian"))
			var zhuangObject = getTopAndLeft(document.querySelector(".class-div-wanfa-textzhuang"))
			var dataObject = {
					ds: currentMark,
			    	fq: ["xiandui", "he", "zhuangdui", "xian", "zhuang"],
			    	top: [xianduiObject.top, heObject.top, zhuangduiObject.top, xianObject.top, zhuangObject.top],
			    	left: [xianduiObject.left, heObject.left, zhuangduiObject.left, xianObject.left, zhuangObject.left],
			    	tableNumber: ROOM_ID,
			}
				var newRequest = {
					url: urlPath,
					type: "post",
					data: dataObject,
					success: function(data) {
						var newData = data
						var result = JSON.parse(newData).data
						FAKE_COIN_ARRAY = {}
						for (var i = 0; i < result.length; i++) {
							var item = result[i]
							if (!(item.sj in FAKE_COIN_ARRAY)) {
								FAKE_COIN_ARRAY[item.sj] = []
							}
							FAKE_COIN_ARRAY[item.sj].push({
								dianshu: item.ds,
								shijian: item.sj,
								wanfa: item.fq1,
								topValue: item.top1,
								leftValue: item.left1,
							})
						}
						var keys = Object.keys(FAKE_COIN_ARRAY)
						for (var i = 0; i < keys.length; i++) {
						   var keyItem = keys[i]
						   if (Number(keyItem) >= ( n - 15 )) {
							   for (var j = 0; j < FAKE_COIN_ARRAY[keyItem].length; j++) {
								   var coin = FAKE_COIN_ARRAY[keyItem][j]
								   justSetCoin(coin)
							   }
						   }
						}
						var autoCreateCoinEvent = setInterval(function() {
							if($("#bjllot").length==0){
								clearInterval(autoCreateCoinEvent)
								return;
							}
							var currentTime = document.querySelector("#id-span-clockTimeNumber").innerHTML
							if (currentTime == "0") {
								clearInterval(autoCreateCoinEvent)
							}
							if (FAKE_COIN_ARRAY[currentTime] != undefined) {
								for (var i = 0; i < FAKE_COIN_ARRAY[currentTime].length; i++) {
									var item = FAKE_COIN_ARRAY[currentTime][i]
									insertStaticCoin(item)
								}
							}
						}, 1000)
					},
					error: function(status) {
					}
				}
			ajax(newRequest)			
		}
		
		
		//获取期号
		var getMarkInfo = function(n) {
			var urlPath =  "/b/bjlLotter.do"
			var newRequest = {
				url: urlPath,
				type: "post",
				data: {
					tableNumber: ROOM_ID,
				},
				success: function(data) {
					var newData = JSON.parse(data)
					currentMark = newData.data.nextIssueNumber
					console.log(currentMark,"currentMark我拿到的期号")
					//插入jia硬币
					getFakeCoinsFromServer(n)
				},
				error: function(status) {
				}
			}
			ajax(newRequest)
		 }
		
		
		// 获取用户的钱
		var getUserMoneyNumber = function() {
			var urlPath =  "/b/Money.do"
				var newRequest = {
					url: urlPath,
					type: "post",
					data: {
					},
					success: function(data) {
						var newData = JSON.parse(data)
						var currentMoneySpan = document.querySelector("#id-span-userCurrentMoney")
						currentMoneySpan.innerHTML = newData.data
					},
					error: function(status) {
					}
				}
				ajax(newRequest)				
		} 	
		
		// 初始化音乐播放器
		var initAutoMusicPlayer = function() {
			if(isIphone){
				MUSIC_PATH =  "/music/"
			} else {
				MUSIC_PATH =  "/music/android/"
		    }
			var bgMp3 = MUSIC_PATH + "bg.mp3"
			var DownMp3=MUSIC_PATH + "countDown.mp3"
			BG_SOUND = new Howl({
				  src: [bgMp3],
 				  loop: true,
			})
			BG_SOUND.play()
			playAuto(BG_SOUND)
 			Down_SOUND = new Howl({
				  src: [DownMp3],
			})
			
			
 			BET_START_SOUND = new Howl({
				  src: [MUSIC_PATH + "betStart.mp3"],
			})
			BET_END_SOUND = new Howl({
				  src: [MUSIC_PATH + "betEnd.mp3"],
			})	
		}
		
	 	//开关音乐按钮     默认开
		function bindCheckIOmusicEvent(){
			var music=document.querySelector("#IO-music")
				music.onclick=function(){
				console.log($("#IO-music").attr("src"))
				if($("#IO-music").attr("src")=="/img/caizhong/bjl/onmusic-2x.png"){
					music.src="/img/caizhong/bjl/closemusic-2x.png"
					BG_SOUND.stop()
				}else{
					music.src="/img/caizhong/bjl/onmusic-2x.png"
					BG_SOUND.play()
				}
					/*i++
					if(i%2==1){
						music.src="/img/caizhong/bjl/closemusic-2x.png"
							BG_SOUND.stop()
						
					}else{
						music.src="/img/caizhong/bjl/onmusic-2x.png"
							BG_SOUND.play()
					}*/
				}
					
			}
		
		// 动态插入硬币的图片
		function addCoinImg(id) {
			var imgArr = COIN_IMG_OBJECT[id]
			var allImgs = ""
			for (var i = 0; i < imgArr.length; i++) {
				var item = imgArr[i]
				var html = "<div style='background-size:contain;background-repeat:no-repeat; background-image:url("+ "/img/caizhong/bjl/coin-" + item + "-2x.png);' data-index='" + (i + 1) + "' data-coinnum='" + item + "' class='class-img-gameCoin'></div>"
				//var html = "<img src='/cp/img/caizhong/bjl/coin-" + item + "-2x.png' data-index='" + (i + 1) + "' data-coinnum='" + item + "' class='class-img-gameCoin'/>"
				allImgs += html
			}
			$("#id-div-gameCoinsGroup").prepend(allImgs)
		}
		
		// 更新历史开奖记录
		var upDateCurrentGameBet = function(callback) {
			// ajax
 			var urlPath =  "/b/history.do"
			var newRequest = {
				url: urlPath,
				type: "post",
				data: {tableNumber: ROOM_ID},
				success: function(data) {
					var newData = JSON.parse(data)
					console.log(newData,"newData的值")
					console.log(newData.data.length,"newData的值")
					var documentFragment = document.createDocumentFragment()
					for (var i = 0; i < newData.data.length; i++) {
						var item = newData.data[i]
						// 期号     庄点数       闲点数   是否有对子
						//var dataArray = item.split(":")
						var xianyinClass = ""
						var zhuangyinClass = ""
						var xianduiClass = ""
						var zhuangduiClass = ""
						if (item.makerSFinalPoints > item.leisureHomePoints) {
							zhuangyinClass = "zhuangWin"
						}
						else if (item.makerSFinalPoints < item.leisureHomePoints) {
							xianyinClass = "xianWin"
						}
						else {
							zhuangyinClass = "zhuangWin"
							xianyinClass = "xianWin"
						}
						if (item.idleTime == 1) {
							zhuangduiClass = "extra-div-duizi"
						}
						else if (item.zhuangPairs == 1) {
							xianduiClass = "extra-div-duizi"
						}
						else if (item.idleTime == 1 && item.zhuangPairs == 1) {
							zhuangduiClass = "extra-div-duizi"
							xianduiClass = "extra-div-duizi"
						}
						var newTr = document.createElement("tr")
						var td1 = document.createElement("td") 
						var td2 = document.createElement("td") 
						var td3 = document.createElement("td")
						td2.className = zhuangduiClass
						td3.className = xianduiClass
						var span2 = document.createElement("span") 
						var span3 = document.createElement("span")
						td1.textContent = item.issueNumber.substring(8,12)
						span2.className = "zhuangNormal " + zhuangyinClass
						span2.textContent =item.makerSFinalPoints
						span3.className = "xianNormal " + xianyinClass
						span3.textContent = item.leisureHomePoints
						td2.appendChild(span2)
						td3.appendChild(span3)
						newTr.appendChild(td1)
						newTr.appendChild(td2)
						newTr.appendChild(td3)
						documentFragment.appendChild(newTr)
					}
  					document.querySelector(".tbody-xiazhuRecordList").innerHTML = ""
  					document.querySelector(".tbody-xiazhuRecordList").appendChild(documentFragment)
					callback()
 				},
				error: function(status) {
				}
			}
			ajax(newRequest)			
		}
		
		
		
		//开启或关闭 本局下注记录按钮
		var bindCheckBetBtnEvent = function() {
			var betDiv = document.querySelector("#div-i-xiazhuBtnWrapper")
			document.querySelector(".ul-c-detailBetInfo").style.marginBottom = document.querySelector("#div-i-xiazhuBtnWrapper").clientHeight + "px"
			var ulElement = document.querySelector(".ul-c-detailBetInfo")
			betDiv.addEventListener(getNormalClickEvent(), function(event) {	
				if (!ulElement.classList.contains("ul-c-BetInfo-in")) {
					upDateCurrentGameBet(function() {
						ulElement.style.display = "block"
						setTimeout(function() {
							ulElement.classList.add("ul-c-BetInfo-in")
						}, 100)						
					})
				}
/* 				else {
					ulElement.classList.remove("ul-c-BetInfo-in")
					setTimeout(function() {
						ulElement.style.display = "none"
					}, 100)
				} */
			})
			document.querySelector(".class-div-content").addEventListener(getNormalClickEvent(), function(event) {
				var target = event.target
				if (ulElement.classList.contains("ul-c-BetInfo-in") && ($(target).closest(".ul-c-detailBetInfo").length == 0)) {
					ulElement.classList.remove("ul-c-BetInfo-in")
					setTimeout(function() {
						ulElement.style.display = "none"
					}, 100)					
				}
			})
		}
		
		function layerContent(totalBet){
			if( !isHorizontalScreen()){
				 $(".layui-layer").css('transform' , 'rotate(90deg)')
				  $(".layui-layer").attr('transform' , 'rotate(90deg)')
				layer.open({
				    type: 1,
				    skin: 'layui-layer-molv',
				    area:['220px',"100px"],
				    title:false,
				    shadeClose: false, //点击遮罩关闭
				    anim: 3,
				    content: "投注成功"+totalBet+"元，祝您好运",    //右边也可以自己定义样式，引用时最外面的那个id,如$("#"+"ID名")
				    btn:'知道了',
				  });
			}else{
				layer.open({
				    type: 1,
				    area:['220px',"100px"],
				    title:false,
				    shadeClose: false, //点击遮罩关闭
				    anim: 3,
				    content: "投注成功"+totalBet+"元，祝您好运",    //右边也可以自己定义样式，引用时最外面的那个id,如$("#"+"ID名")
				    btn:'知道了',
				  });
			}
			
		}
		// 实时调整位置
		var width = document.documentElement.clientWidth
  		var height = document.documentElement.clientHeight
		  if( !isHorizontalScreen()){
			  console.log("竖屏")
		      $print =  $('#print');
		      $print.width(height);
		      $print.height(width);
		      $print.css('top',  (height-width)/2 );
		      $print.css('left',  0-(height-width)/2 );
		      $print.css('transform' , 'rotate(90deg)');
		      $print.css('transform-origin' , '50% 50%');
		      setFontSize(height)
		 } else {
		 	setFontSize(width)
		 }
		   var getRight1 = function() {
				   var rightNum = document.querySelector(".class-div-part").clientWidth / 2 + document.querySelector(".class-div-xian").clientWidth
				   return rightNum 
		   }
		   var getItemWidth = function() {
			   var itemWidth = document.documentElement.dataset.fontrem * 1.1
			   return itemWidth
		   }
		   var getRight2 = function() {
			   var rightNum = getRight1() + getItemWidth() + (document.documentElement.dataset.fontrem * 0.2)
			   return rightNum
		   }
		   var getRight3 = function() {
			   var rightNum = document.querySelector(".class-div-part").clientWidth - getItemWidth() - getRight1()
			   return rightNum
		   }
		   var getRight4 = function() {
			   var rightNum = getRight3() - getItemWidth() - (document.documentElement.dataset.fontrem * 0.2)
			   return rightNum
		   }
		   var getRight5 = function() {
			   var rightNum = document.querySelector(".class-div-part").clientWidth / 2 + document.querySelector(".class-div-xian").clientWidth + document.documentElement.dataset.fontrem * 0.2 * 2 + document.documentElement.dataset.fontrem * 1.1 * 2
			   return rightNum
		   }  
		   
		   var getRight6 = function() {
			   var rightNumItem1 = document.querySelector(".class-div-part").clientWidth / 2 + document.querySelector(".class-div-xian").clientWidth
			   var rightNumItem2 = document.querySelector(".class-div-part").clientWidth - getItemWidth() - rightNumItem1
			   var rightNum = rightNumItem2 - (getItemWidth() * 2) - (document.documentElement.dataset.fontrem * 0.2 * 2)
			   return rightNum
		   }

		   var getVerticalTop = function() {
				   var verticalTopValue = document.querySelector(".class-div-part").offsetTop + 5
				   return verticalTopValue
			   }
		   var getHorizontalTop = function() {
			   console.log(document.querySelector(".class-div-part"),'sdfsdsdfdssdf')
			   var horizontalTopValue = getOffsetSum(document.querySelector(".class-div-part")).top
			   return horizontalTopValue
		   }		  
		var evt = "onorientationchange" in window ? "orientationchange" : "resize";
		window.addEventListener(evt, function() {
			setTimeout(function() {
			    $print =  $('#print');
		   		var width = document.documentElement.clientWidth;
				var height =  document.documentElement.clientHeight;  
			    if(isHorizontalScreen()){
			    
			        $print.width(width);
			        $print.height(height);
			        $print.css('top',  0 );
			        $print.css('left',  0 );
			        $print.css('transform' , 'none');
			        $print.css('transform-origin' , '50% 50%');
			        setFontSize(width)
			    	var cardItems = document.querySelectorAll(".cardItemRight")
			    	var horizontalTop = getHorizontalTop() + "px"
			    	console.log(horizontalTop,"horizontalTop的值")
			    	for (var i = 0; i < cardItems.length; i++) {
			    		var item = cardItems[i]
			    		item.style.top = horizontalTop
			    	}
			     }
			     else{
			        $print.width(height);
			        $print.height(width);
			        $print.css('top',  (height-width)/2 );
			        $print.css('left',  0-(height-width)/2 );
			        $print.css('transform' , 'rotate(90deg)');
			        $print.css('transform-origin' , '50% 50%');
			        setFontSize(height)
			    	var cardItems = document.querySelectorAll(".cardItemRight")
			    	var verticalTop = getVerticalTop() + "px"
			    	console.log(verticalTop,"verticalTop的值")
			    	for (var i = 0; i < cardItems.length; i++) {
			    		var item = cardItems[i]
			    		item.style.top = verticalTop
			    	}
			     }
			     var item0 = document.querySelector("#id-div-cardItemDiv0")
			     var item1 = document.querySelector("#id-div-cardItemDiv1")
			     var item2 = document.querySelector("#id-div-cardItemDiv2")
			     var item3 = document.querySelector("#id-div-cardItemDiv3")
			     var item5 = document.querySelector("#id-div-cardItemDiv5")
			     var item6 = document.querySelector("#id-div-cardItemDiv6")
			     var right0 = getRight1()
			     var right1 = getRight2()
			     var right2 = getRight3()  
			     var right3 = getRight4()
			     var right5 = getRight5()
			     var right6 = getRight6()
			    document.querySelector(".ul-c-detailBetInfo").style.marginBottom = document.querySelector("#div-i-xiazhuBtnWrapper").clientHeight + "px"
			     if (item0 != null) {
			    	 item0.style.right = right0 + "px" 
			     }
			     if (item1 != null) {
			    	 item1.style.right = right1 + "px" 
			     }
			     if (item2 != null) {
			    	 item2.style.right = right2 + "px" 
			     }
			     if (item3 != null) {
			    	 item3.style.right = right3 + "px" 
			     }
			     if (item5 != null) {
			    	 item5.style.right = right5 +  "px"
			     }
			     if (item6 != null) {
			    	 item6.style.right = right6 +  "px"
			     }	
			}, 700)
		}, false);		
		
		//获取开奖的数据
		var accesstoAwardOpeningData = function(){
			ajax({
				url:"/b/takeAwayTheAwardData.do",
				type: post,
				data: {
					tableNumber: ROOM_ID,
					issueNumber: currentMark,
				},
				success: function(data) {
					var newData = JSON.parse(data) 
					console.log(newData,"accesstoAwardOpeningData")
					zhuangXianArray = newData
				},
				error: function(status) {
				}
			})
		}
		
		/* function playAudio(audio) {
		        if (window.WeixinJSBridge) {
		            WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
		                audio.play();
		            }, false);
		        } else {
		            document.addEventListener("WeixinJSBridgeReady", function () {
		                WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
		                    audio.play();
		                });
		            }, false);
		        }
		        audio.play();
		        return false;
		    }*/
		 
		 
		 function playAuto(ele) {
		     document.addEventListener('WeixinJSBridgeReady', function (evt) {
		             ele.play();
		     }, false);
		 }
		 
		 
	/*	 
		 function autoPlayMusic() {
		        // 自动播放音乐效果，解决浏览器或者APP自动播放问题
		        function musicInBrowserHandler() {
		            musicPlay(true);
		            document.body.removeEventListener('touchstart', musicInBrowserHandler);
		        }
		        document.body.addEventListener('touchstart', musicInBrowserHandler);

		        // 自动播放音乐效果，解决微信自动播放问题
		        function musicInWeixinHandler() {
		            musicPlay(true);
		            document.addEventListener("WeixinJSBridgeReady", function () {
		                musicPlay(true);
		            }, false);
		            document.removeEventListener('DOMContentLoaded', musicInWeixinHandler);
		        }
		        document.addEventListener('DOMContentLoaded', musicInWeixinHandler);
		    }
		    
		    autoPlayMusic();
		 
		 */
		/*// 退出游戏按钮
 	    $(".btn-span-returnToRoom").on(getEndClickEvent(), function(e) {
 	    	$("*").remove()
 	    	//window.location.href =  "/lotter/lot.do?zl=bjl"
 	    })*/